public class Demo10 {
    public static void main(String[] args) {
        int sum = 0;
        int num = 1;
        long x = 1; //阶乘
        long y = 0; //阶乘和
        while (num < 1000) {
            x *= num;
            y += x;
            num++;
            System.out.println(y % 1000000000);
        }
    }
}
